/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * newCommentPanel.java
 *
 * Created on 22/Out/2012, 10:18:29
 */
package chatclient;

/**
 *
 * @author Old
 */
public class newCommentPanel extends javax.swing.JPanel {
    
    public ChatSDClientView pai;
    private int postId;

    /** Creates new form newCommentPanel */
    public newCommentPanel() {
        initComponents();
    }

    public newCommentPanel(ChatSDClientView pai, int postId) {
        this.pai = pai;
        this.postId = postId;
        initComponents();
    }
    
    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        commentText = new javax.swing.JTextArea();
        butGuardar = new javax.swing.JButton();
        butCancelar = new javax.swing.JButton();

        setMaximumSize(new java.awt.Dimension(480, 100));
        setMinimumSize(new java.awt.Dimension(480, 100));
        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(480, 100));

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(chatclient.ChatSDClientApp.class).getContext().getResourceMap(newCommentPanel.class);
        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        commentText.setColumns(20);
        commentText.setRows(5);
        commentText.setName("commentText"); // NOI18N
        jScrollPane1.setViewportView(commentText);

        butGuardar.setText(resourceMap.getString("butGuardar.text")); // NOI18N
        butGuardar.setName("butGuardar"); // NOI18N
        butGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butGuardarActionPerformed(evt);
            }
        });

        butCancelar.setText(resourceMap.getString("butCancelar.text")); // NOI18N
        butCancelar.setName("butCancelar"); // NOI18N
        butCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butCancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(butGuardar)
                    .addComponent(butCancelar))
                .addGap(36, 36, 36))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel1)
                                .addComponent(jLabel5))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(35, 35, 35)
                        .addComponent(butGuardar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(butCancelar)))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

private void butCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butCancelarActionPerformed
// TODO add your handling code here:
    pai.resetToolPanel();
}//GEN-LAST:event_butCancelarActionPerformed

private void butGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butGuardarActionPerformed
// TODO add your handling code here:
    pai.newCommentSubmit(commentText.getText(), postId);
    pai.resetToolPanel();
}//GEN-LAST:event_butGuardarActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton butCancelar;
    private javax.swing.JButton butGuardar;
    private javax.swing.JTextArea commentText;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
}
